﻿CREATE TABLE [dbo].[FavoriteImage]
(
	[Id] BIGINT NOT NULL IDENTITY(1,1) PRIMARY KEY,
	[UserId] BIGINT NOT NULL,
	[ImageId] BIGINT NOT NULL,
	CONSTRAINT [FK_FavoriteImage_Image] FOREIGN KEY ([ImageId]) 
		REFERENCES [dbo].[Image] ([Id]) ON DELETE CASCADE ON UPDATE NO ACTION,
	CONSTRAINT [FK_FavoriteImage_User] FOREIGN KEY ([UserId]) 
		REFERENCES [dbo].[User] ([Id]) ON DELETE NO ACTION ON UPDATE NO ACTION,
	CONSTRAINT [UQ_FavoriteImage_Image_User] UNIQUE ([ImageId], [UserId])
)
